package com.haste.common.domain.vo;

import lombok.Data;

import java.io.Serializable;

/**
 * @author haste
 */
@Data
public class ResponseVo<T> implements Serializable {

    private String code;
    private String msg;
    private T data;

    public ResponseVo<T> ok(){
        return new ResponseVo<>();
    }

    public ResponseVo<T> ok(T data){
        return new ResponseVo<>(data);
    }

    public ResponseVo<T> ok(T data,String msg){
        return new ResponseVo<>(data,msg);
    }

    public ResponseVo<T> ok(T data,String msg,String code){
        return new ResponseVo<>(data,msg,code);
    }


    public ResponseVo(){
        this.data = null;
        this.msg = "成功";
        this.code = "200";
    }

    public ResponseVo(T data){
        this.data = data;
        this.msg = "成功";
        this.code = "200";
    }

    public ResponseVo(T data,String msg){
        this.data = data;
        this.msg = msg;
        this.code = "200";
    }

    public ResponseVo(T data,String msg,String code){
        this.data = data;
        this.msg = msg;
        this.code = code;
    }
}
